#ifndef SCS_H
#define SCS_H

#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>

typedef		char			s8;
typedef		unsigned char	u8;
typedef		unsigned short	u16;
typedef		short			s16;
typedef		unsigned long	u32;
typedef	    long			s32;
typedef     unsigned long   DWORD;


class SCS
{
public:
    SCS();
    void WritePos(u8 cmd_);    
	void WriteSpeAPos(u8 spe_cmd_,u8 pos_cmd_);      
    u16 Read_Cur_Pos();
    u16 Read_Cur_Spe();
	u16 Read_Cur_Load();
    

private:
    u16 Command_init(u8 Data[]);
    void Command_Send(u8 Data[]);
    void initdata(u16 pos);
    void receive_data();

private:
    int udp_clientfd;
    u8 command[10];
    u16 CRC_VALUE;
    u16 CRC_IDNEX;
    struct sockaddr_in cli;
    u8 recevbuf[1024];
    u8 recedatalen;


public:
    u16 location_value;     //  位置更新
    u16 load_value;         //  负载更新
    u16 speed_value;        //  速度更新
    u8 read_error_flag;

};

#endif // SCS_H
